home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 25 / AACD 25.iso / AACD / Graphics / PerfectPaint / rexx / box / ZoomBlur.rx < prev   
Encoding:
Text File  |  2000-10-31  |  2.0 KB  |  130 lines

  1. /*     arexx Script 
  2.     Zoom Blur
  3. */
  4.  
  5.     call addlib("rexxmathlib.library", 5, -30, 0)
  6.  
  7.     options results
  8.     parse ARG Port x1 y1 x2 y2 b
  9.  
  10.     ADDRESS COMMAND
  11.     Alias=0
  12.     Opacity=85
  13.     Amplitude=5
  14.     IF EXISTS('PerfectPaint:Prefs/Rexx_Prefs/ZoomBlur') THEN DO
  15.         IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/ZoomBlur', "R") then DO
  16.             Amplitude= READLN('lfile')
  17.             Opacity= READLN('lfile')
  18.             Alias= READLN('lfile')
  19.             CALL CLOSE('lfile')
  20.         END
  21.     END
  22.     
  23.     ADDRESS value Port
  24.  
  25.     pp_GetDepth
  26.     D=result
  27.     IF D<24 then DO
  28.         pp_Warn 'This*script*is*only|for*24bits*Picture.'    
  29.         pp_PermitRefresh
  30.         Exit
  31.     END
  32.  
  33.     pp_DialogInit 250 95 "*Zoom*Blur*" 3
  34.         pp_Integer 0 140 5 50 16 "Amplitude*(2-16)" 1 Amplitude
  35.         pp_Integer 1 140 25 50 16 "Opacity*(0-100)" 1 Opacity
  36.         pp_Cycle   2 140 45 50 16 "Antialiasing" 1 "None|Good" Alias
  37.     pp_Dialog
  38.     rc=result
  39.     IF rc=0 then DO
  40.         EXIT
  41.     END
  42.  
  43.     pp_GetDialog 0
  44.     Amplitude=result
  45.  
  46.     pp_GetDialog 1
  47.     Opacity=result
  48.  
  49.     pp_GetDialog 2
  50.     Alias=result
  51.  
  52.     IF Alias=1 then DO
  53.         pp_AliasOn
  54.     END
  55.  
  56.   CALL SavePrefs('ZoomBlur',Amplitude,Opacity,Alias)
  57.     ADDRESS value Port
  58.  
  59.     pp_StencilStat
  60.     Stencil=result
  61.  
  62.     pp_PicttoSpare
  63.     pp_SpareOnOff    
  64.  
  65.     if Stencil=1 then DO
  66.         pp_StencilOff
  67.     END
  68.  
  69.     W=x2-x1+1
  70.     H=y2-y1+1
  71.  
  72.     Mix=50
  73.     Dec=1
  74.     pp_BrushOpacity 50
  75.  
  76.     j=1
  77.     do i=1 to Amplitude
  78.         pp_PickBrush x1 y1 W H
  79.         pp_GetWidthB
  80.         Wb=result
  81.         pp_GetHeightB
  82.         Hb=result
  83.         Sw=trunc(Wb+j+0.5,3)
  84.         Sh=trunc(Hb+j+0.5,3)
  85.          pp_ScaleBrush Sw Sh
  86.         pp_BrushOpacity Mix
  87.          pp_plot x1+W/2 y1+H/2
  88.        j=j+1
  89.         Mix=Mix-Dec
  90.     END
  91.  
  92.     IF Stencil=1 then DO
  93.         pp_StencilOn
  94.     END
  95.  
  96.     pp_FreeBrush
  97.  
  98.     pp_SpareOnOff
  99.     pp_ComposeReqOff
  100.     pp_UpdateUndoBox x1 y1 x2 y2    
  101.     pp_EffectOn
  102.     pp_Spare
  103.     pp_Compose 0 Opacity 0
  104.     pp_Boxf x1 y1 x2 y2
  105.     pp_EffectOff
  106.     pp_ComposeReqOn
  107.  
  108. EXIT
  109.  
  110. SavePrefs: PROCEDURE
  111.     
  112.     Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  113.     say prefname
  114.  
  115.     if EXISTS(Prefname) THEN DO
  116.         ADDRESS COMMAND
  117.         'delete >nil: '||Prefname
  118.     END
  119.  
  120.     IF OPEN('pfile',PrefName,'W') THEN DO
  121.  
  122.     do i=2 to ARG()
  123.         CALL WRITELN('pfile',ARG(i))
  124.     end
  125.  
  126.     CALL CLOSE('pfile')
  127.  
  128. RETURN
  129.  
  130.